<?php
declare(strict_types=1);
namespace app\admin\controller;

use app\admin\BaseController;
use app\admin\service\RobotService;
use think\App;
use think\Response;
use think\response\View;

class Robot extends BaseController
{
    public function index(): View
    {
        return view('robot/index');
    }

    public function friend():View
    {
        return  view('robot/friend');
    }
    public function group():View
    {
        return  view('robot/group');
    }

    public function getData(): Response
    {
        $ret = (new RobotService())->getRobotList();
        return echoJson(successJson($ret));
    }

    /**
     * @throws \think\db\exception\DbException
     */
    public function getFriend():Response
    {
        $ret = (new RobotService())->dbFriend();
        return  echoJson(successJson($ret));
    }

    public function getGroup(): Response
    {
        $ret = (new RobotService())->dbGroup();
        return echoJson(successJson($ret));
    }

    public function setGroup():Response
    {
        $ret = (new RobotService())->setGroup(input());
        return echoJson($ret);
    }

}